/**
 * 
 */
package com.eagle.coders.security.transaction.beans;

import java.io.Serializable;
import java.math.BigDecimal;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.eagle.coders.cbs.admin.beans.TransactionCode;

//import my.com.infopro.icba10.admin.domain.TransactionCode;
//import my.com.infopro.icba10.kernel.base.domain.BaseDomainObject;
//import my.com.infopro.icba10.kernel.security.accesscontrol.domain.GroupLevel;
//import my.com.infopro.icba10.kernel.util.validation.annotation.ValidateMandatory;
//import my.com.infopro.icba10.kernel.util.validation.annotation.ValidateNumeric;


@Entity
//@NamedQueries({
//        @NamedQuery(name = "TransactionLimit.findTransLmt", query = "select o from TransactionLimit o " +
//        "left outer join fetch o.transCodeObj where o.transCode=:transCode " +
//        "and o.moduleCode=:moduleCode and o.groupCode = :groupCode and o.groupLevel = :groupLevel"),
//        @NamedQuery(name="TransactionLimit.findTransactionLimitsByGroupAndLevel", query="select o from TransactionLimit" +
//        " o where o.groupCode=:groupCode and o.groupLevel=:groupLevel"),
//        @NamedQuery(name="TransactionLimit.findApprovalLimit", query = "select o from TransactionLimit o where " +
//                "o.transCode =:transCode and o.groupCode =:groupCode and o.groupLevel =:groupLevel and o.moduleCode =:moduleCode")
//        
//})
@Table(name="SY98SEC_TRN_LMT")
@IdClass(TransactionLimitPK.class)
public class TransactionLimit implements Serializable{
//extends BaseDomainObject implements Serializable{
    
	private static final long serialVersionUID = 1L;

	private String transCode;
    
    private String groupCode;
    
    private Integer groupLevel;
    
    private String moduleCode;
    
    private String currencyCode;
    
    private BigDecimal limit;
    
    private TransactionCode transCodeObj;
//    
//    private GroupLevel groupLvl;

    
    public TransactionLimit(String groupCode, Integer groupLevel) {
    	this.groupCode = groupCode;
    	this.groupLevel = groupLevel;
    }
    
    public TransactionLimit() {
    	
    }
    
    @Id
    @Column(name="FCCD", nullable=false, insertable=false, updatable=false)
//    @ValidateMandatory
    public String getCurrencyCode() {
        return currencyCode;
    }

    public void setCurrencyCode(String currencyCode) {
        this.currencyCode = currencyCode;
    }
    
    @Id
    @Column(name="GRP_CD", nullable=false, insertable=false, updatable=false)
    public String getGroupCode() {
        return groupCode;
    }

    public void setGroupCode(String groupCode) {
        this.groupCode = groupCode;
    }
    
    @Id
    @Column(name="GRP_LVL", nullable=false, insertable=false, updatable=false)
    public Integer getGroupLevel() {
        return groupLevel;
    }

    public void setGroupLevel(Integer groupLevel) {
        this.groupLevel = groupLevel;
    }
    
    @Id
    @Column(name="MOD_CD", nullable=false, insertable=false, updatable=false)
//    @ValidateMandatory
    public String getModuleCode() {
        return moduleCode;
    }

    public void setModuleCode(String moduleCode) {
        this.moduleCode = moduleCode;
    }
    
    @Id
    @Column(name="TRN_CD", nullable=false, insertable=false, updatable=false)
//    @ValidateMandatory
    public String getTransCode() {
        return transCode;
    }

    public void setTransCode(String transCode) {
        this.transCode = transCode;
    }
    
    @Column(name="LMT")
    public BigDecimal getLimit() {
        return limit;
    }

//    @ValidateNumeric(minValue = 1, maxValue = 99)
//    @ValidateMandatory
    public void setLimit(BigDecimal limit) {
        this.limit = limit;
    }

    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinColumns({
    @JoinColumn(name = "TRN_CD", referencedColumnName = "TRN_CD",nullable = false, insertable = false, updatable = false),
    @JoinColumn(name = "MOD_CD", referencedColumnName = "MOD_CD", nullable = false, insertable = false, updatable = false)
    })
    public TransactionCode getTransCodeObj() {
        return transCodeObj;
    }

    public void setTransCodeObj(TransactionCode transCodeObj) {
        this.transCodeObj = transCodeObj;
    }
    
    
//    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
//    @JoinColumns({
//    	@JoinColumn(name="GRP_CD", nullable=false, insertable=false, updatable=false),
//    	@JoinColumn(name="GRP_LVL",nullable=false, insertable =false,updatable=false)
//    })
//	public GroupLevel getGroupLvl() {
//		return groupLvl;
//	}
//	
//	public void setGroupLvl(GroupLevel groupLvl) {
//		this.groupLvl = groupLvl;
//	}
//    
    
    
    
}
